from django.shortcuts import render
from luffyapi.settings import contants
# Create your views here.
from rest_framework.generics import ListAPIView

from .models import Banner
from .serializers import BannerListModelSerializer
class BannerListAPIView(ListAPIView):
    queryset =Banner.objects.filter(is_show=True,is_delete=False).order_by('orders','-id')[:contants.HOME_BANNER_LENGTH]
    serializer_class = BannerListModelSerializer


from .models import Nav
from .serializers import NavModelSerializer
class HeaderNavListAPIView(ListAPIView):
    queryset = Nav.objects.filter(is_show=True, is_delete=False, position=0).order_by("orders","-id")[:contants.HOME_HEADER_LENGTH]
    serializer_class = NavModelSerializer

class FooterNavListAPIView(ListAPIView):
    queryset = Nav.objects.filter(is_show=True, is_delete=False, position=1).order_by("orders","-id")[:contants.HOME_FOOTER_LENGTH]
    serializer_class = NavModelSerializer